package com.yanqu.road.server.cmd.group;

import com.yanqu.road.pb.cross.group.CrossGroupProto;
import com.yanqu.road.pb.worldmessage.WorldMessageProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.group.GroupChatMgr;
import com.yanqu.road.server.manger.ServerGroupMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_CROSS_GROUP_CHAT, desc = "跨服分组聊天")
public class CrossGroupChatCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossGroupProto.CrossGroupChatReqMsg reqMsg = CrossGroupProto.CrossGroupChatReqMsg.parseFrom(packet.getBytes());
        int groupId = ServerGroupMgr.getGroupIdByServerId(serverId);
        WorldMessageProto.WorldMessageTempMsg chatMsg = reqMsg.getMsg();
        GroupChatMgr.groupChat(groupId, chatMsg);
    }

    @Override
    public void sendData() {

    }
}
